import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import '../../../app/zepto.js';
import LazyImage from 'components/LazyImage';
import Link from '../../main/components/Link';
import Redirect from '../../main/components/Redirect';
import Agreement from '../../main/components/Agreement';
import './Image';

jest.mock('wpt');
jest.mock('@wpt/showHide');
jest.mock('../../../app/zepto.js');

window.LazyImage = LazyImage;
window.Link = Link;
window.Redirect = Redirect;
window.Agreement = Agreement;


Enzyme.configure({
    adapter: new Adapter(),
});
if (process.argv[3]) {
    const Name = process.argv[3].split('=')[1];
    // 单个执行只有在运行Carousel时才加载
    if (Name && Name.indexOf('Carousel') > -1) {
        require('matchmedia-polyfill');
    }
    if (Name && Name.indexOf('Featured') > -1) {
        require('matchmedia-polyfill');
    }
    if (Name && Name.indexOf('NewShare') > -1) {
        require('matchmedia-polyfill');
    }
} else {
    // 全部执行也需要加载
    require('matchmedia-polyfill');
}